#include <stdio.h>
int main()
{
    int litre, type;
    char c;
    double price[100];
    price[90] = 6.95;
    price[93] = 7.44;
    price[97] = 7.93;
    scanf("%d %d %c", &litre, &type, &c);
    printf("%.2lf", litre * price[type] * (c == 'm' ? 0.95 : 0.97));
    return 0;
}